home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / audio / DAT / y.tab.c < prev   
Encoding:
C/C++ Source or Header  |  1994-08-02  |  20.1 KB  |  905 lines

  1. # define LEADIN 257
  2. # define LEADOUT 258
  3. # define BOT 259
  4. # define EOT 260
  5. # define RATE 261
  6. # define COPY 262
  7. # define PROGRAM 263
  8. # define INDEX 264
  9. # define PAUSE 265
  10. # define SILENCE 266
  11. # define FRAMES 267
  12. # define FREAD 268
  13. # define FWRITE 269
  14. # define SEEK 270
  15. # define INTEGER 271
  16. # define BOOLEAN 272
  17. # define PROGNUM 273
  18. # define ATIME 274
  19. # define PTIME 275
  20. # define COLON 276
  21. # define WHERE 277
  22. # define WHERENOT 278
  23. # define READFRAME 279
  24. # define QUIT 280
  25. # define STRING 281
  26. # define TESTPAT 282
  27. # define COMMENT 283
  28.  
  29. # line 3 "commands.y"
  30. extern int dat;
  31. static int h,m,s,f;
  32. static int p;
  33. extern char last_string[];
  34.  
  35. #include <malloc.h>
  36. #include <memory.h>
  37. #include <unistd.h>
  38. #include <values.h>
  39.  
  40. #ifdef __cplusplus
  41.  
  42. #ifndef yyerror
  43.     void yyerror(const char *);
  44. #endif
  45. #ifndef yylex
  46.     extern "C" int yylex(void);
  47. #endif
  48.     int yyparse(void);
  49.  
  50. #endif
  51. #define yyclearin yychar = -1
  52. #define yyerrok yyerrflag = 0
  53. extern int yychar;
  54. extern int yyerrflag;
  55. #ifndef YYSTYPE
  56. #define YYSTYPE int
  57. #endif
  58. YYSTYPE yylval;
  59. YYSTYPE yyval;
  60. typedef int yytabelem;
  61. #ifndef YYMAXDEPTH
  62. #define YYMAXDEPTH 150
  63. #endif
  64. #if YYMAXDEPTH > 0
  65. int yy_yys[YYMAXDEPTH], *yys = yy_yys;
  66. YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
  67. #else    /* user does initial allocation */
  68. int *yys;
  69. YYSTYPE *yyv;
  70. #endif
  71. static int yymaxdepth = YYMAXDEPTH;
  72. # define YYERRCODE 256
  73. yytabelem yyexca[] ={
  74. -1, 1,
  75.     0, -1,
  76.     -2, 0,
  77.     };
  78. # define YYNPROD 55
  79. # define YYLAST 105
  80. yytabelem yyact[]={
  81.  
  82.     22,    23,    58,    57,    24,    25,    26,    27,    28,    29,
  83.     73,    38,    37,    30,    50,    51,    70,    33,    34,    43,
  84.     31,    32,    35,    36,    63,    39,    40,    65,    52,    47,
  85.     48,    55,    75,    52,    72,    69,    68,    62,    55,    59,
  86.     46,    45,    44,    42,    53,    49,     2,    74,    41,    71,
  87.     67,    54,    21,    20,    19,    18,    17,    16,    15,    14,
  88.     13,    12,    11,    10,     9,     8,     7,     6,     5,     4,
  89.      3,     1,     0,     0,     0,     0,     0,     0,     0,    56,
  90.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  91.      0,     0,    60,    61,     0,     0,     0,     0,     0,     0,
  92.      0,     0,     0,    66,    64 };
  93. yytabelem yypact[]={
  94.  
  95.   -257,  -257,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,
  96. -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,
  97. -10000000,-10000000,-10000000,-10000000,  -228,  -253,  -229,  -230,-10000000,  -231,
  98.   -245,-10000000,-10000000,  -233,  -233,-10000000,-10000000,  -278,  -279,  -232,
  99. -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,  -233,  -233,-10000000,
  100. -10000000,-10000000,  -234,-10000000,  -252,-10000000,-10000000,-10000000,  -240,-10000000,
  101. -10000000,-10000000,-10000000,  -235,-10000000,  -236,-10000000,  -260,-10000000,-10000000,
  102.   -237,  -266,-10000000,  -239,-10000000,-10000000 };
  103. yytabelem yypgo[]={
  104.  
  105.      0,    71,    46,    70,    69,    68,    67,    66,    65,    64,
  106.     63,    62,    61,    60,    59,    58,    57,    56,    55,    54,
  107.     53,    52,    45,    44,    51,    50,    49,    47 };
  108. yytabelem yyr1[]={
  109.  
  110.      0,     1,     1,     2,     2,     2,     2,     2,     2,     2,
  111.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  112.      2,     2,    17,    12,    13,    16,     3,     4,     5,     6,
  113.     19,    19,    19,    18,     7,     7,     8,     8,     9,    20,
  114.     10,    14,    15,    22,    11,    11,    11,    11,    11,    24,
  115.     25,    26,    27,    23,    21 };
  116. yytabelem yyr2[]={
  117.  
  118.      0,     2,     4,     2,     2,     2,     2,     2,     2,     2,
  119.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  120.      2,     2,     3,     3,     3,     3,     3,     3,     5,     5,
  121.      7,     9,     7,     5,     3,     5,     3,     5,     3,     5,
  122.      5,     5,     5,     5,     7,     7,     5,     5,     5,     3,
  123.      3,     3,     3,    14,     2 };
  124. yytabelem yychk[]={
  125.  
  126. -10000000,    -1,    -2,    -3,    -4,    -5,    -6,    -7,    -8,    -9,
  127.    -10,   -11,   -12,   -13,   -14,   -15,   -16,   -17,   -18,   -19,
  128.    -20,   -21,   257,   258,   261,   262,   263,   264,   265,   266,
  129.    270,   277,   278,   274,   275,   279,   280,   269,   268,   282,
  130.    283,    -2,   271,   272,   271,   271,   271,   274,   275,   -22,
  131.    259,   260,   273,   -23,   -24,   271,   -23,   281,   281,   271,
  132.    -23,   -23,   271,   276,   -22,   267,   -23,   -25,   271,   271,
  133.    276,   -26,   271,   276,   -27,   271 };
  134. yytabelem yydef[]={
  135.  
  136.      0,    -2,     1,     3,     4,     5,     6,     7,     8,     9,
  137.     10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
  138.     20,    21,    26,    27,     0,     0,    34,    36,    38,     0,
  139.      0,    23,    24,     0,     0,    25,    22,     0,     0,     0,
  140.     54,     2,    28,    29,    35,    37,    40,     0,     0,    46,
  141.     47,    48,     0,    41,     0,    49,    42,    33,     0,    39,
  142.     44,    45,    43,     0,    30,     0,    32,     0,    50,    31,
  143.      0,     0,    51,     0,    53,    52 };
  144. typedef struct
  145. #ifdef __cplusplus
  146.     yytoktype
  147. #endif
  148. { char *t_name; int t_val; } yytoktype;
  149. #ifndef YYDEBUG
  150. #    define YYDEBUG    0    /* don't allow debugging */
  151. #endif
  152.  
  153. #if YYDEBUG
  154.  
  155. yytoktype yytoks[] =
  156. {
  157.     "LEADIN",    257,
  158.     "LEADOUT",    258,
  159.     "BOT",    259,
  160.     "EOT",    260,
  161.     "RATE",    261,
  162.     "COPY",    262,
  163.     "PROGRAM",    263,
  164.     "INDEX",    264,
  165.     "PAUSE",    265,
  166.     "SILENCE",    266,
  167.     "FRAMES",    267,
  168.     "FREAD",    268,
  169.     "FWRITE",    269,
  170.     "SEEK",    270,
  171.     "INTEGER",    271,
  172.     "BOOLEAN",    272,
  173.     "PROGNUM",    273,
  174.     "ATIME",    274,
  175.     "PTIME",    275,
  176.     "COLON",    276,
  177.     "WHERE",    277,
  178.     "WHERENOT",    278,
  179.     "READFRAME",    279,
  180.     "QUIT",    280,
  181.     "STRING",    281,
  182.     "TESTPAT",    282,
  183.     "COMMENT",    283,
  184.     "-unknown-",    -1    /* ends search */
  185. };
  186.  
  187. char * yyreds[] =
  188. {
  189.     "-no such reduction-",
  190.     "script : command",
  191.     "script : script command",
  192.     "command : leadin",
  193.     "command : leadout",
  194.     "command : rate",
  195.     "command : copy",
  196.     "command : program",
  197.     "command : index",
  198.     "command : pause",
  199.     "command : silence",
  200.     "command : seek",
  201.     "command : where",
  202.     "command : wherenot",
  203.     "command : atime",
  204.     "command : ptime",
  205.     "command : readframe",
  206.     "command : quit",
  207.     "command : write",
  208.     "command : read",
  209.     "command : testpat",
  210.     "command : comment",
  211.     "quit : QUIT",
  212.     "where : WHERE",
  213.     "wherenot : WHERENOT",
  214.     "readframe : READFRAME",
  215.     "leadin : LEADIN",
  216.     "leadout : LEADOUT",
  217.     "rate : RATE INTEGER",
  218.     "copy : COPY BOOLEAN",
  219.     "read : FREAD STRING prog",
  220.     "read : FREAD STRING FRAMES INTEGER",
  221.     "read : FREAD STRING timecode",
  222.     "write : FWRITE STRING",
  223.     "program : PROGRAM",
  224.     "program : PROGRAM INTEGER",
  225.     "index : INDEX",
  226.     "index : INDEX INTEGER",
  227.     "pause : PAUSE",
  228.     "testpat : TESTPAT INTEGER",
  229.     "silence : SILENCE INTEGER",
  230.     "atime : ATIME timecode",
  231.     "ptime : PTIME timecode",
  232.     "prog : PROGNUM INTEGER",
  233.     "seek : SEEK ATIME timecode",
  234.     "seek : SEEK PTIME timecode",
  235.     "seek : SEEK prog",
  236.     "seek : SEEK BOT",
  237.     "seek : SEEK EOT",
  238.     "hours : INTEGER",
  239.     "minutes : INTEGER",
  240.     "seconds : INTEGER",
  241.     "frames : INTEGER",
  242.     "timecode : hours COLON minutes COLON seconds COLON frames",
  243.     "comment : COMMENT",
  244. };
  245. #endif /* YYDEBUG */
  246. /* 
  247.  *    Copyright 1987 Silicon Graphics, Inc. - All Rights Reserved
  248.  */
  249.  
  250. /* #ident    "@(#)yacc:yaccpar    1.10" */
  251. #ident    "$Revision: 1.9 $"
  252.  
  253. /*
  254. ** Skeleton parser driver for yacc output
  255. */
  256.  
  257. /*
  258. ** yacc user known macros and defines
  259. */
  260. #define YYERROR        goto yyerrlab
  261. #define YYACCEPT    return(0)
  262. #define YYABORT        return(1)
  263. #ifdef __cplusplus
  264. #define YYBACKUP( newtoken, newvalue )\
  265. {\
  266.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  267.     {\
  268.         yyerror( gettxt("uxlibc:78", "syntax error - cannot backup") );\
  269.         goto yyerrlab;\
  270.     }\
  271.     yychar = newtoken;\
  272.     yystate = *yyps;\
  273.     yylval = newvalue;\
  274.     goto yynewstate;\
  275. }
  276. #else
  277. #define YYBACKUP( newtoken, newvalue )\
  278. {\
  279.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  280.     {\
  281.         yyerror( gettxt("uxlibc:78", "Syntax error - cannot backup") );\
  282.         goto yyerrlab;\
  283.     }\
  284.     yychar = newtoken;\
  285.     yystate = *yyps;\
  286.     yylval = newvalue;\
  287.     goto yynewstate;\
  288. }
  289. #endif
  290. #define YYRECOVERING()    (!!yyerrflag)
  291. #define YYNEW(type)    malloc(sizeof(type) * yynewmax)
  292. #define YYCOPY(to, from, type) \
  293.     (type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
  294. #define YYENLARGE( from, type) \
  295.     (type *) realloc((char *) from, yynewmax * sizeof(type))
  296. #ifndef YYDEBUG
  297. #    define YYDEBUG    1    /* make debugging available */
  298. #endif
  299.  
  300. /*
  301. ** user known globals
  302. */
  303. int yydebug;            /* set to 1 to get debugging */
  304.  
  305. /*
  306. ** driver internal defines
  307. */
  308. #define YYFLAG        (-10000000)
  309.  
  310. /*
  311. ** global variables used by the parser
  312. */
  313. YYSTYPE *yypv;            /* top of value stack */
  314. int *yyps;            /* top of state stack */
  315.  
  316. int yystate;            /* current state */
  317. int yytmp;            /* extra var (lasts between blocks) */
  318.  
  319. int yynerrs;            /* number of errors */
  320. int yyerrflag;            /* error recovery flag */
  321. int yychar;            /* current input token number */
  322.  
  323.  
  324.  
  325. /*
  326. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  327. */
  328. #if defined(__STDC__) || defined(__cplusplus)
  329. int yyparse(void)
  330. #else
  331. int yyparse()
  332. #endif
  333. {
  334.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  335.  
  336.     /*
  337.     ** Initialize externals - yyparse may be called more than once
  338.     */
  339.     yypv = &yyv[-1];
  340.     yyps = &yys[-1];
  341.     yystate = 0;
  342.     yytmp = 0;
  343.     yynerrs = 0;
  344.     yyerrflag = 0;
  345.     yychar = -1;
  346.  
  347. #if YYMAXDEPTH <= 0
  348.     if (yymaxdepth <= 0)
  349.     {
  350.         if ((yymaxdepth = YYEXPAND(0)) <= 0)
  351.         {
  352. #ifdef __cplusplus
  353.             yyerror(gettxt("uxlibc:79", "yacc initialization error"));
  354. #else
  355.             yyerror(gettxt("uxlibc:79", "Yacc initialization error"));
  356. #endif
  357.             YYABORT;
  358.         }
  359.     }
  360. #endif
  361.  
  362.     goto yystack;
  363.     {
  364.         register YYSTYPE *yy_pv;    /* top of value stack */
  365.         register int *yy_ps;        /* top of state stack */
  366.         register int yy_state;        /* current state */
  367.         register int  yy_n;        /* internal state number info */
  368.  
  369.         /*
  370.         ** get globals into registers.
  371.         ** branch to here only if YYBACKUP was called.
  372.         */
  373.     yynewstate:
  374.         yy_pv = yypv;
  375.         yy_ps = yyps;
  376.         yy_state = yystate;
  377.         goto yy_newstate;
  378.  
  379.         /*
  380.         ** get globals into registers.
  381.         ** either we just started, or we just finished a reduction
  382.         */
  383.     yystack:
  384.         yy_pv = yypv;
  385.         yy_ps = yyps;
  386.         yy_state = yystate;
  387.  
  388.         /*
  389.         ** top of for (;;) loop while no reductions done
  390.         */
  391.     yy_stack:
  392.         /*
  393.         ** put a state and value onto the stacks
  394.         */
  395. #if YYDEBUG
  396.         /*
  397.         ** if debugging, look up token value in list of value vs.
  398.         ** name pairs.  0 and negative (-1) are special values.
  399.         ** Note: linear search is used since time is not a real
  400.         ** consideration while debugging.
  401.         */
  402.         if ( yydebug )
  403.         {
  404.             register int yy_i;
  405.  
  406.             printf( "State %d, token ", yy_state );
  407.             if ( yychar == 0 )
  408.                 printf( "end-of-file\n" );
  409.             else if ( yychar < 0 )
  410.                 printf( "-none-\n" );
  411.             else
  412.             {
  413.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  414.                     yy_i++ )
  415.                 {
  416.                     if ( yytoks[yy_i].t_val == yychar )
  417.                         break;
  418.                 }
  419.                 printf( "%s\n", yytoks[yy_i].t_name );
  420.             }
  421.         }
  422. #endif /* YYDEBUG */
  423.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  424.         {
  425.             int yynewmax, yys_off;
  426.  
  427.             /* The following pointer-differences are safe, since
  428.              * yypvt, yy_pv, and yypv all are a multiple of
  429.              * sizeof(YYSTYPE) bytes from yyv.
  430.              */
  431.             int yypvt_off = yypvt - yyv;
  432.             int yy_pv_off = yy_pv - yyv;
  433.             int yypv_off = yypv - yyv;
  434.  
  435.             int *yys_base = yys;
  436. #ifdef YYEXPAND
  437.             yynewmax = YYEXPAND(yymaxdepth);
  438. #else
  439.             yynewmax = 2 * yymaxdepth;    /* double table size */
  440.             if (yymaxdepth == YYMAXDEPTH)    /* first time growth */
  441.             {
  442.                 void *newyys = YYNEW(int);
  443.                 void *newyyv = YYNEW(YYSTYPE);
  444.                 if (newyys != 0 && newyyv != 0)
  445.                 {
  446.                     yys = YYCOPY(newyys, yys, int);
  447.                     yyv = YYCOPY(newyyv, yyv, YYSTYPE);
  448.                 }
  449.                 else
  450.                     yynewmax = 0;    /* failed */
  451.             }
  452.             else                /* not first time */
  453.             {
  454.                 yys = YYENLARGE(yys, int);
  455.                 yyv = YYENLARGE(yyv, YYSTYPE);
  456.                 if (yys == 0 || yyv == 0)
  457.                     yynewmax = 0;    /* failed */
  458.             }
  459. #endif
  460.             if (yynewmax <= yymaxdepth)    /* tables not expanded */
  461.             {
  462. #ifdef __cplusplus
  463.                 yyerror( gettxt("uxlibc:80", "yacc stack overflow") );
  464. #else
  465.                 yyerror( gettxt("uxlibc:80", "Yacc stack overflow") );
  466. #endif
  467.                 YYABORT;
  468.             }
  469.             yymaxdepth = yynewmax;
  470.  
  471.             /* reset pointers into yys */
  472.             yys_off = yys - yys_base;
  473.             yy_ps = yy_ps + yys_off;
  474.             yyps = yyps + yys_off;
  475.  
  476.             /* reset pointers into yyv */
  477.             yypvt = yyv + yypvt_off;
  478.             yy_pv = yyv + yy_pv_off;
  479.             yypv = yyv + yypv_off;
  480.         }
  481.         *yy_ps = yy_state;
  482.         *++yy_pv = yyval;
  483.  
  484.         /*
  485.         ** we have a new state - find out what to do
  486.         */
  487.     yy_newstate:
  488.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  489.             goto yydefault;        /* simple state */
  490. #if YYDEBUG
  491.         /*
  492.         ** if debugging, need to mark whether new token grabbed
  493.         */
  494.         yytmp = yychar < 0;
  495. #endif
  496.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  497.             yychar = 0;        /* reached EOF */
  498. #if YYDEBUG
  499.         if ( yydebug && yytmp )
  500.         {
  501.             register int yy_i;
  502.  
  503.             printf( "Received token " );
  504.             if ( yychar == 0 )
  505.                 printf( "end-of-file\n" );
  506.             else if ( yychar < 0 )
  507.                 printf( "-none-\n" );
  508.             else
  509.             {
  510.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  511.                     yy_i++ )
  512.                 {
  513.                     if ( yytoks[yy_i].t_val == yychar )
  514.                         break;
  515.                 }
  516.                 printf( "%s\n", yytoks[yy_i].t_name );
  517.             }
  518.         }
  519. #endif /* YYDEBUG */
  520.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  521.             goto yydefault;
  522.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  523.         {
  524.             yychar = -1;
  525.             yyval = yylval;
  526.             yy_state = yy_n;
  527.             if ( yyerrflag > 0 )
  528.                 yyerrflag--;
  529.             goto yy_stack;
  530.         }
  531.  
  532.     yydefault:
  533.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  534.         {
  535. #if YYDEBUG
  536.             yytmp = yychar < 0;
  537. #endif
  538.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  539.                 yychar = 0;        /* reached EOF */
  540. #if YYDEBUG
  541.             if ( yydebug && yytmp )
  542.             {
  543.                 register int yy_i;
  544.  
  545.                 printf( "Received token " );
  546.                 if ( yychar == 0 )
  547.                     printf( "end-of-file\n" );
  548.                 else if ( yychar < 0 )
  549.                     printf( "-none-\n" );
  550.                 else
  551.                 {
  552.                     for ( yy_i = 0;
  553.                         yytoks[yy_i].t_val >= 0;
  554.                         yy_i++ )
  555.                     {
  556.                         if ( yytoks[yy_i].t_val
  557.                             == yychar )
  558.                         {
  559.                             break;
  560.                         }
  561.                     }
  562.                     printf( "%s\n", yytoks[yy_i].t_name );
  563.                 }
  564.             }
  565. #endif /* YYDEBUG */
  566.             /*
  567.             ** look through exception table
  568.             */
  569.             {
  570.                 register int *yyxi = yyexca;
  571.  
  572.                 while ( ( *yyxi != -1 ) ||
  573.                     ( yyxi[1] != yy_state ) )
  574.                 {
  575.                     yyxi += 2;
  576.                 }
  577.                 while ( ( *(yyxi += 2) >= 0 ) &&
  578.                     ( *yyxi != yychar ) )
  579.                     ;
  580.                 if ( ( yy_n = yyxi[1] ) < 0 )
  581.                     YYACCEPT;
  582.             }
  583.         }
  584.  
  585.         /*
  586.         ** check for syntax error
  587.         */
  588.         if ( yy_n == 0 )    /* have an error */
  589.         {
  590.             /* no worry about speed here! */
  591.             switch ( yyerrflag )
  592.             {
  593.             case 0:        /* new error */
  594. #ifdef __cplusplus
  595.                 yyerror( gettxt("uxlibc:81", "syntax error") );
  596. #else
  597.                 yyerror( gettxt("uxlibc:81", "Syntax error") );
  598. #endif
  599.                 goto skip_init;
  600.             yyerrlab:
  601.                 /*
  602.                 ** get globals into registers.
  603.                 ** we have a user generated syntax type error
  604.                 */
  605.                 yy_pv = yypv;
  606.                 yy_ps = yyps;
  607.                 yy_state = yystate;
  608.                 yynerrs++;
  609.                 /* FALLTHRU */
  610.             skip_init:
  611.             case 1:
  612.             case 2:        /* incompletely recovered error */
  613.                     /* try again... */
  614.                 yyerrflag = 3;
  615.                 /*
  616.                 ** find state where "error" is a legal
  617.                 ** shift action
  618.                 */
  619.                 while ( yy_ps >= yys )
  620.                 {
  621.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  622.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  623.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  624.                         /*
  625.                         ** simulate shift of "error"
  626.                         */
  627.                         yy_state = yyact[ yy_n ];
  628.                         goto yy_stack;
  629.                     }
  630.                     /*
  631.                     ** current state has no shift on
  632.                     ** "error", pop stack
  633.                     */
  634. #if YYDEBUG
  635. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  636.                     if ( yydebug )
  637.                         printf( _POP_, *yy_ps,
  638.                             yy_ps[-1] );
  639. #    undef _POP_
  640. #endif
  641.                     yy_ps--;
  642.                     yy_pv--;
  643.                 }
  644.                 /*
  645.                 ** there is no state on stack with "error" as
  646.                 ** a valid shift.  give up.
  647.                 */
  648.                 YYABORT;
  649.             case 3:        /* no shift yet; eat a token */
  650. #if YYDEBUG
  651.                 /*
  652.                 ** if debugging, look up token in list of
  653.                 ** pairs.  0 and negative shouldn't occur,
  654.                 ** but since timing doesn't matter when
  655.                 ** debugging, it doesn't hurt to leave the
  656.                 ** tests here.
  657.                 */
  658.                 if ( yydebug )
  659.                 {
  660.                     register int yy_i;
  661.  
  662.                     printf( "Error recovery discards " );
  663.                     if ( yychar == 0 )
  664.                         printf( "token end-of-file\n" );
  665.                     else if ( yychar < 0 )
  666.                         printf( "token -none-\n" );
  667.                     else
  668.                     {
  669.                         for ( yy_i = 0;
  670.                             yytoks[yy_i].t_val >= 0;
  671.                             yy_i++ )
  672.                         {
  673.                             if ( yytoks[yy_i].t_val
  674.                                 == yychar )
  675.                             {
  676.                                 break;
  677.                             }
  678.                         }
  679.                         printf( "token %s\n",
  680.                             yytoks[yy_i].t_name );
  681.                     }
  682.                 }
  683. #endif /* YYDEBUG */
  684.                 if ( yychar == 0 )    /* reached EOF. quit */
  685.                     YYABORT;
  686.                 yychar = -1;
  687.                 goto yy_newstate;
  688.             }
  689.         }/* end if ( yy_n == 0 ) */
  690.         /*
  691.         ** reduction by production yy_n
  692.         ** put stack tops, etc. so things right after switch
  693.         */
  694. #if YYDEBUG
  695.         /*
  696.         ** if debugging, print the string that is the user's
  697.         ** specification of the reduction which is just about
  698.         ** to be done.
  699.         */
  700.         if ( yydebug )
  701.             printf( "Reduce by (%d) \"%s\"\n",
  702.                 yy_n, yyreds[ yy_n ] );
  703. #endif
  704.         yytmp = yy_n;            /* value to switch over */
  705.         yypvt = yy_pv;            /* $vars top of value stack */
  706.         /*
  707.         ** Look in goto table for next state
  708.         ** Sorry about using yy_state here as temporary
  709.         ** register variable, but why not, if it works...
  710.         ** If yyr2[ yy_n ] doesn't have the low order bit
  711.         ** set, then there is no action to be done for
  712.         ** this reduction.  So, no saving & unsaving of
  713.         ** registers done.  The only difference between the
  714.         ** code just after the if and the body of the if is
  715.         ** the goto yy_stack in the body.  This way the test
  716.         ** can be made before the choice of what to do is needed.
  717.         */
  718.         {
  719.             /* length of production doubled with extra bit */
  720.             register int yy_len = yyr2[ yy_n ];
  721.  
  722.             if ( !( yy_len & 01 ) )
  723.             {
  724.                 yy_len >>= 1;
  725.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  726.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  727.                     *( yy_ps -= yy_len ) + 1;
  728.                 if ( yy_state >= YYLAST ||
  729.                     yychk[ yy_state =
  730.                     yyact[ yy_state ] ] != -yy_n )
  731.                 {
  732.                     yy_state = yyact[ yypgo[ yy_n ] ];
  733.                 }
  734.                 goto yy_stack;
  735.             }
  736.             yy_len >>= 1;
  737.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  738.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  739.                 *( yy_ps -= yy_len ) + 1;
  740.             if ( yy_state >= YYLAST ||
  741.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  742.             {
  743.                 yy_state = yyact[ yypgo[ yy_n ] ];
  744.             }
  745.         }
  746.                     /* save until reenter driver code */
  747.         yystate = yy_state;
  748.         yyps = yy_ps;
  749.         yypv = yy_pv;
  750.     }
  751.     /*
  752.     ** code supplied by user is placed in this switch
  753.     */
  754.     switch( yytmp )
  755.     {
  756.         
  757. case 22:
  758. # line 15 "commands.y"
  759. {
  760.         quit();
  761.     } break;
  762. case 23:
  763. # line 20 "commands.y"
  764. {
  765.         get_tape_pos(dat,0);
  766.     } break;
  767. case 24:
  768. # line 25 "commands.y"
  769. {
  770.         read_position(dat);
  771.     } break;
  772. case 25:
  773. # line 30 "commands.y"
  774. {
  775.         get_tape_pos(dat,1);
  776.     } break;
  777. case 26:
  778. # line 35 "commands.y"
  779. {
  780.         write_bot(dat);
  781.     } break;
  782. case 27:
  783. # line 40 "commands.y"
  784. {
  785.         write_eot(dat);
  786.     } break;
  787. case 28:
  788. # line 45 "commands.y"
  789. {
  790.         set_rate(yylval);
  791.     } break;
  792. case 29:
  793. # line 50 "commands.y"
  794. {
  795.         copy_prohibit(yylval);
  796.     } break;
  797. case 30:
  798. # line 56 "commands.y"
  799. {
  800.         read_file(dat,last_string,p,0,0,0,0);
  801.     } break;
  802. case 31:
  803. # line 60 "commands.y"
  804. {
  805.         read_frames(dat,last_string,yylval);
  806.     } break;
  807. case 32:
  808. # line 64 "commands.y"
  809. {
  810.         read_file(dat,last_string,0,h,m,s,f);
  811.     } break;
  812. case 33:
  813. # line 70 "commands.y"
  814. {
  815.         write_file(dat,last_string);
  816.     } break;
  817. case 34:
  818. # line 76 "commands.y"
  819. {
  820.         inc_program();
  821.     } break;
  822. case 35:
  823. # line 80 "commands.y"
  824. {
  825.         set_program(yylval);
  826.     } break;
  827. case 36:
  828. # line 86 "commands.y"
  829. {
  830.         inc_index();
  831.     } break;
  832. case 37:
  833. # line 90 "commands.y"
  834. {
  835.         set_index(yylval);
  836.     } break;
  837. case 38:
  838. # line 96 "commands.y"
  839. {
  840.         pause();
  841.     } break;
  842. case 39:
  843. # line 102 "commands.y"
  844. {
  845.         write_testpat(dat,yylval);
  846.     } break;
  847. case 40:
  848. # line 108 "commands.y"
  849. {
  850.         write_silence(dat,yylval);
  851.     } break;
  852. case 41:
  853. # line 114 "commands.y"
  854. {
  855.         set_atime(h,m,s,f);
  856.     } break;
  857. case 42:
  858. # line 119 "commands.y"
  859. {
  860.         set_ptime(h,m,s,f);
  861.     } break;
  862. case 43:
  863. # line 123 "commands.y"
  864. { p = yylval; } break;
  865. case 44:
  866. # line 126 "commands.y"
  867.         seek_time(dat,1,h,m,s,f);
  868.     } break;
  869. case 45:
  870. # line 130 "commands.y"
  871. {
  872.         seek_time(dat,0,h,m,s,f);
  873.     } break;
  874. case 46:
  875. # line 134 "commands.y"
  876. {
  877.         seek_prog(dat,p);
  878.     } break;
  879. case 47:
  880. # line 138 "commands.y"
  881. {
  882.         seek_bot(dat);
  883.     } break;
  884. case 48:
  885. # line 142 "commands.y"
  886. {
  887.         seek_eot(dat);
  888.     } break;
  889. case 49:
  890. # line 147 "commands.y"
  891. { h = yylval; } break;
  892. case 50:
  893. # line 148 "commands.y"
  894. { m = yylval; } break;
  895. case 51:
  896. # line 149 "commands.y"
  897. { s = yylval; } break;
  898. case 52:
  899. # line 150 "commands.y"
  900. { f = yylval; } break;
  901.     }
  902.     goto yystack;        /* reset registers in driver code */
  903. }
  904.